{% extends 'base.html' %}

{% block page-main %}
    <div class="container-fluid">
        <div class="row">
            {% include 'manage_nav.html' %}
            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                <h1 class="page-header">所有文章</h1>

                <div class="panel panel-primary">
                    <!-- Default panel contents -->
                    <div class="panel-heading">所有文章</div>
                    <div class="panel-body">
                        <div class="row" style="margin-bottom: 15px">
                            <div class="pull-right">
                                <a href="/article_add/" class="btn btn-success">添加文章</a>
                            </div>
                        </div><!-- /.row -->

                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>序号</th>
                                <th>id</th>
                                <th>文章标题</th>
                                <th>作者</th>
                                <th>所属分类</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for article in all_articles %}
                                <tr>
                                    <td>{{ forloop.counter }}</td>
                                    <td>{{ article.id }}</td>
                                    <td>{{ article.title }}</td>
                                    <td>{{ article.author.name }}</td>
                                    <td>{{ article.category.bigcategory.title }}-{{ article.category.subcategory.title }}</td>
                                    <td>
                                        <a class="btn btn-danger" href="{% url 'article_del' article.pk %}">删除</a>
                                        <a class="btn btn-info" href="{% url 'article_edit' article.pk %}">编辑</a>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
{% endblock %}